package com.aaa.member.controller;

import com.aaa.common.util.Result;
import com.aaa.member.entity.Member;
import com.aaa.member.service.MemberService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * 会员表(Member)表控制层
 *
 * @author makejava
 * @since 2020-11-17 20:42:37
 */
@RestController
@RequestMapping("member")
public class MemberController {
    /**
     * 服务对象
     */
    @Resource
    private MemberService memberService;

    /**
     * 通过主键查询单条数据
     *
     * @param id 主键
     * @return 单条数据
     */
    @GetMapping("selectOne")
    public Member selectOne(Long id) {
        return this.memberService.queryById(id);
    }

    /**
     * 通过用户名查询
     * @param phone
     * @return
     */
    @GetMapping("queryUserByParam")
    public Member queryUserByParam(@RequestParam("phone") String phone){
        return this.memberService.queryMemberByParam(phone);
    }

    @GetMapping("memberLogin")
    public Result memberLogin(String phone, String password){
        return memberService.memberLogin(phone,password);
    }
}